import java.util.ArrayList;
import java.util.Scanner;

public class Solution {
    public int removeDuplicates(int[] nums){
        int n = nums.length;
        int index = 1;
        for (int i = 0; i < n-1; i++) {
            if(nums[i] != nums[i+1]){
                nums[index] = nums[i + 1];
                index++;
            }
        }
        return index;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int len = in.nextInt();
            int[] nums = new int[len];
            for (int i = 0; i < len; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            int result = solution.removeDuplicates(nums);
            System.out.println(result);
        }
    }
}
